#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a[200010],q,ans;
int read(){
	int s=0;
	char ch=getchar(),last=' ';
	while(ch<'0'||ch>'9')
		last=ch,ch=getchar();
	while(ch>='0'&&ch<='9')
		s=(s<<1)+(s<<3)+(ch^48),ch=getchar();
	return last=='-'?-s:s;
}
signed main(){
	freopen("pockets.in","r",stdin);
	freopen("pockets.out","w",stdout);
	n=read();
	for(int i=1;i<n;i++)
		a[i]=read();
	q=read();
	while(q--){
		a[n]=read();
		if(n==3)
			ans=a[1]+a[3]-a[2];
		if(n==4)
			ans=a[1]+max(a[3],a[4])-a[2]-min(a[3],a[4]);
		if(n==5){
			if(a[3]+a[4]<=a[5])
				ans=a[1]+a[5]-a[2]-a[3]-a[4];
			else
				if(a[3]+a[5]<=a[4])
					ans=a[1]+a[4]-a[2]-a[3]-a[5];
				else
					ans=a[1]+a[3]+min(a[4],a[5])-a[2]-max(a[4],a[5]);
		}
		printf("%lld\n",ans);
	}
    return 0;
}


